const http = uni.$u.http

import {
	tansParams,
	handleParams,
	formatGetParams
} from "@/utils/http/tool"

class Request {
	get({
		url,
		params = {},
		config = {}
	}) {
		return http.get(url, formatGetParams({
			config,
			params
		}))
	}
	post({
		url,
		params = {},
		config = {}
	}) {
		return http.post(url, params, handleParams(config))
	}
	delete({
		url,
		params = {},
		config = {}
	}) {
		return http.delete(url, params, handleParams(config))
	}
	put({
		url,
		params = {},
		config = {}
	}) {
		return http.put(url, params, handleParams(config))
	}
	request(config) {
		return http.request(config)
	}
}

export default new Request();